1. Field of the Invention
The present invention relates to a coordinate difference calculation apparatus and a coordinate difference calculation method for calculating a difference between coordinates of two particles.
2. Description of the Related Art
In molecular dynamics, when the force acting on i-particle is calculated, all particles except i-particle are regarded as j-particles, and the total of forces acting between i-particle and each j-particle is obtained. Generally, since the force acting between two particles depends on the distance between the particles, first, there is a need to obtain the distance between the particles.
However, when all particles except i-particle are regarded as j-particles, the calculation amount is enormous. So, in recent years, the force acting on i-particle is calculated according to the periodic boundary condition.
In the periodic boundary condition, a predetermined basic cell in a rectangular parallelepiped shape is considered, and only particles existing in the same basic cell as the i-particle are regarded as j-particles. Also, it is assumed that j-particles are arranged in each of the surrounding basic cell in the same way, a j-particle that provides the minimum distance from an i-particle is regarded as an object to be calculated among j-particles existing in the same basic call as the i-particle and in the surrounding basic cells, and the force acting on an i-particle from a j-particle, which is the object to be calculated, is calculated.
Hereinafter, detailed explanations are given of the periodic boundary condition with reference to FIG. 1 to FIG. 3.
FIGS. 1 to 3 are two-dimensional views showing basic cells in the XY-plane. Incidentally, in FIG. 1 to FIG. 3, each basic cell has a side that is Lx in length in the X-axis direction, a side that is Ly in length in the Y-axis direction, and a side that is Lz in length in the Z-axis direction, not shown. Further, each basic cell is divided into a plurality of minute cells. Also, though there is generally a plurality of particles in each minute cell, in FIG. 1 to FIG. 3, only necessary particles are shown to simplify explanations.
In the example in FIG. 1, i-particle exists in the center basic cell. Also, j-particle exists in the same basic cell as i-particle, and it is assumed that j-particle exists also in each of the surrounding basic cell in the same way. Incidentally, hereinafter, for convenience of explanation, a j-particle in the same basic cell as an i-particle is called a j0-particle and j-particles in surrounding basic cells are each called j1- to j8-particles. Among these j0- to j8-particles, a j0-particle in the same basic cell as an i-particle provides the minimum distance from the i-particle. In this case, according to the periodic boundary condition, j0-particle is regarded as the object to be calculated and the force acting on i-particle from j0-particle is calculated.
On the other hand, in the example in FIG. 2, among j0- to j8-particles, the minimum distance from the i-particle is provided by the j6-particle in the surrounding basic cell, not by the j0-particle in the same basic cell as i-particle. In this case, according to the periodic boundary condition, the j6-particle is regarded as the object to be calculated and the force acting on an i-particle from the j6-particle is calculated.
Similarly, in the example in FIG. 3, among j0- to j8-particles, the minimum distance from the i-particle is provided by the j8-particle in the surrounding basic cell, not by the j0-particle in the same basic cell as i-particle. In this case, according to the periodic boundary condition, a j8-particle is regarded as the object to be calculated and the force acting on an i-particle from the j8-particle is calculated.
The method disclosed in Patent Document 1 (Japanese Patent Laid-Open No. 06-176052) is known as the method of obtaining the distance between particles according to the periodic boundary condition, as described above.
In the method disclosed in Patent Document 1, first, the coordinate difference between an i-particle and a j0-particle in the same basic cell is calculated. Successively, the calculation result of the difference is compared with ±½ of the length of one side of the basic cell. Then, when the calculation result of the difference is larger than ½ of the length of one side of the basic cell, the length of one side of the basic cell is subtracted from the calculation result of the difference, and when the calculation result of the difference is smaller than −½ of the length of one side in the basic cell, the length of one side of the basic cell is added to the calculation result of the difference. According to this operation, the distance between particles is calculated based on the periodic boundary condition.
Specifically, when the coordinate difference in the X-axis direction is calculated in the example in FIG. 1, first, the coordinate difference between the i-particle and the j0-particle is calculated. This case does not satisfy the requirement that the calculation result of the difference be larger than Lx/2 nor that the calculation result of the difference be smaller than −Lx/2. Therefore, neither addition nor subtraction of Lx is performed.
On the other hand, when the coordinate difference in the X-axis direction is calculated in the example in FIG. 2, first, the difference between an i-particle and a j0-particle is calculated. In this case, it is assumed that the calculation result of the difference is larger than Lx/2. Therefore, Lx is subtracted from the calculation result of the difference, thereby calculating the coordinate difference between an i-particle and a j6-particle.
Also, when the coordinate difference in the X-axis direction is calculated in the example in FIG. 3, first, the difference between an i-particle and a j0-particle is calculated. In this case, it is assumed that the calculation result of the difference is smaller than −Lx/2. Therefore, Lx is added to the calculation result of the difference, thereby calculating the coordinate difference between an i-particle and a j8-particle.
However, in the method disclosed in Patent Document 1, whenever an i-particle is changed, the calculation result of the coordinate difference is compared with ±Lx/2, and Lx is added or subtracted in accordance with the comparison result. Therefore, there is a need to dynamically calculate the periodic boundary condition. Accordingly, the calculation amount of the coordinate difference is increased, and speedup in calculation cannot be attained. Also, in order to enhance the speed of the calculation, a dedicated computing unit that dynamically calculates the periodic boundary condition is required, and the gate amount is increased.